package net.airtheva.uniqueTask4;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.Menu;
import android.view.View;
import android.view.Window;
import android.widget.ImageView;

public class EntryActivity extends Activity {

	public static final String TAG = "EntryActivity";
	
	public static final int TIMEOUT = 3000;
	
	class Launcher implements Runnable {

		@Override
		public void run() {
			// TODO Auto-generated method stub
			
			startActivity(new Intent(EntryActivity.this, MainActivity.class));
			
		}
		
	}
	
	ImageView mImageView;
	
	Handler mHandler;
	Launcher mLauncher;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.activity_entry);
		
		mImageView = (ImageView) findViewById(R.id.activity_entry_logo);
		mImageView.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				
				mHandler.removeCallbacks(mLauncher);
				mLauncher.run();
				
			}
			
		});
		
		mHandler = new Handler();
		mLauncher = new Launcher();
		
		mHandler.postDelayed(mLauncher, TIMEOUT);
		
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

	@Override
	protected void onDestroy() {
		// TODO Auto-generated method stub
		
		super.onDestroy();
	}

}
